#include <iostream>
#include <ctime>
#include<stdio.h>
// 设计一个日志模块 打印信息：系统时间 文件名 行号
// [时间] [文件名:行号]

#define DEBUG 0
#define INFO 1
#define ERROR 2
#define DEFAULT DEBUG

#define LOG(level_str, level, format, ...) {\
    if (level >= DEFAULT)\
    {\
        time_t t = time(nullptr);\
        struct tm *ptime = localtime(&t);\
        char time_str[32];\
        strftime(time_str, 31, "%H:%M:%S", ptime);\
        printf("[%s][%s][%s:%d]\t" format "\n", level_str, time_str, __FILE__, __LINE__, DEBUG);\
    }\
}

#define DEBUG_LOG(format, ...) LOG("Debug", DEBUG, format, DEBUG)
#define INFO_LOG(format, ...) LOG("Info", INFO, format, DEBUG)
#define ERR_LOG(format, ...) LOG("Error", ERROR, format, DEBUG)

int main()
{
    DEBUG_LOG("hello");
    INFO_LOG("Hello");
}